<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Plist/index')}">{:lang('ADMIN_NAV_INDEX')}</a></li>
        <li class="active"><a href="{:url('Plist/add')}">{:lang('ADMIN_NAV_ADD')}</a></li>
        <!--<li><a  href="{:url('nav/edit')}" >{:lang('ADMIN_NAV_EDIT')}</a></li>-->
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Plist/editPost')}">


        <div class="form-group">
            <label  class="col-sm-2 control-label">
                <span class="x-red">*</span>所在校区
            </label>
            <div class="col-md-6 col-sm-10">
                <select lay-filter="school" id="school" class="layui-input" >
                    <option value="">请选择校区</option>
                    <foreach name="school" item="v">
                        <option value="{$v.id}"<if $v.id == $schoolId>selected</if>>{$v.name}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">
                <span class="x-red">*</span>所在专业
            </label>
            <div class="col-md-6 col-sm-10">
                <select lay-filter="major" id="major" class="layui-input" >
                    <option value="">请选择专业</option>
                    <foreach name="major" item="v">
                        <option value="{$v.id}"<if $v.id == $majorId>selected</if>>{$v.major_name}</option>
                    </foreach>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label  class="col-sm-2 control-label">
                <span class="x-red">*</span>所在班级
            </label>
            <div class="col-md-6 col-sm-10">
                <select name=""  id="class" class="layui-input" >
                    <option value="">请选择</option>
                    <foreach name="class" item="v">
                        <option value="{$v.id}"<if $v.id == $data['class_id']>selected</if>>{$v.class_name}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">
                <span class="x-red">*</span>学生
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="sid" id="student" class="layui-input" >
                    <option value="">请选择</option>
                    <foreach name="student" item="v">
                        <option value="{$v.id}"<if $v.id == $plist.sid>selected</if>>{$v.name}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">
                <span class="x-red">*</span>原因
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="rid"  class="layui-input" >
                    <option value="">请选择</option>
                    <foreach name="reason" item="v">
                        <option value="{$v.id}"<if $v.id == $plist.rid>selected</if>>{$v.reason}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>详情:</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="desc" value="{$plist.desc}">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">
                <span class="x-red">*</span>扣分
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="pid"  class="layui-input" >
                    <option value="">请选择</option>
                    <foreach name="point" item="v">
                        <option value="{$v.id}"<if $v.id == $plist.pid>selected</if>>{$v.score}</option>
                    </foreach>
                </select>
            </div>
        </div>


        <input type="hidden" value="{$id}" name="id">

        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary js-ajax-submit">{:lang("SAVE")}</button>
            <a class="btn btn-default" href="{:url('Plist/index')}">返回</a>
        </div>
    </form>

</div>
<script src="__STATIC__/js/admin.js"></script>
<script>

    $(function () {
        // 监听学校下拉框的值改变
        $('#school').on('change',function () {
            var schoolId= $(this).val();
            //ajax
            $.ajax({
                url:'{:url("Plist/Get_major")}',

                data: {school_id:schoolId},
                success: function (r) {
                    $('#major').html(r);
                },
                error: function () {
                    alert('数据获取失败！');
                }
            });
        });
    })
</script>
<script>

    $(function () {
        // 监听学校下拉框的值改变
        $('#major').on('change',function () {
            var majorId= $(this).val();
            //ajax
            $.ajax({
                url:'{:url("Plist/Get_class")}',
                data: {major_id:majorId},
                success: function (r) {
                    $('#class').html(r);
                },
                error: function () {
                    alert('数据获取失败！');
                }
            });
        });
    })
</script>
<script>

    $(function () {
        // 监听学校下拉框的值改变
        $('#class').on('change',function () {
            var studentId= $(this).val();
            //ajax
            $.ajax({
                url:'{:url("Plist/Get_student")}',
                data: {class_id:studentId},
                success: function (r) {
                    $('#student').html(r);
                },
                error: function () {
                    alert('数据获取失败！');
                }
            });
        });
    })
</script>
</body>
</html>